/**
 * @Author: Ray丶X
 * @Date: 2020/3/24
 */

// --------------------------------------
// 文件压缩
// var fs = require('fs');
// var zlib = require('zlib');
//
// fs.createReadStream('input.txt')
//   .pipe(zlib.createGzip())
//   .pipe(fs.createWriteStream('gzInput.txt.gz'));
//
// console.log('文件压缩完成');

// --------------------------------------

// --------------------------------------
// 文件解压
var fs = require('fs');
var zlib = require('zlib');

fs.createReadStream('gzInput.txt.gz')
  .pipe(zlib.createGunzip())
  .pipe(fs.createWriteStream('gzOutput.txt'));

console.log('文件解压完成');

// --------------------------------------
